package xuegao.study.mall.rbac.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xuegao.study.mall.common.api.CommonResult;
import xuegao.study.mall.common.model.ums.UmsDepartmentAdmin;
import xuegao.study.mall.rbac.service.UmsDepartmentAdminService;

@Api(tags = "UmsDepartmentAdminController")
@Tag(name = "UmsDepartmentAdminController", description = "部门用户管理管理接口")
@RestController
@RequestMapping(value = "/department/admin")
public class UmsDepartmentAdminController {

    @Autowired
    private UmsDepartmentAdminService umsDepartmentAdminService;

    @ApiOperation("部门用户关系保存")
    @PostMapping(value = "/save")
    public CommonResult<String> save(@RequestBody UmsDepartmentAdmin departmentAdmin) {
        int count = umsDepartmentAdminService.save(departmentAdmin);
        if (count > 0) {
            return CommonResult.success("ok");
        }
        return CommonResult.failed();
    }
}
